package com.lingxu.base.system.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lingxu.base.system.manage.entity.SysMenu;
import com.lingxu.base.system.manage.model.SysMenuTree;
import com.lingxu.base.system.manage.vo.SysOrgMenuOption;
import com.lingxu.base.system.orgManage.entity.MenuTree;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Description: 菜单信息
 * @Author: LingXu
 * @Date:   2021-01-04
 * @Version: V1.0.1
 */
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    /**
     * 菜单信息-分页列表查询
     * @param page 分页信息
     * @param sysMenu 菜单信息
     * @return 菜单信息列表
     */
    IPage<SysMenu> queryList(@Param("page") Page<SysMenu> page, @Param("sysMenu") SysMenu sysMenu);

    /**
     * 菜单信息-列表查询
     * @param sysMenu 菜单信息
     * @return 菜单信息列表
     */
    List<SysMenu> queryList(@Param("sysMenu") SysMenu sysMenu);

    Set<String> getCodeSetByUserName(String userName);

    /**
     * 获取当前用户的所属菜单
     * @param userId
     * @return
     */
    List<SysMenuTree> getTreeListByUserId(@Param("userId")String userId);

    /**
     * 根据条件获取菜单
     * @param sysOrgMenuOption
     * @return
     */
    List<SysMenuTree> getTreeListInManage(@Param("sysOrgMenuOption") SysOrgMenuOption sysOrgMenuOption);

    @Select("select * from sys_menu where org_id is null")
    List<SysMenu> getAllTypicalMenu();

    /*======================================================sys_menu新================================================================*/

    /**
     * @Author ysj闫世杰
     * @Description 查询菜单列表
     * @Date 2022/6/14 16:47
     * @Param:
     * @return java.util.List<com.lingxu.base.system.orgManage.vo.MenuTree>
     **/
    List<MenuTree> findSysMenuList() throws Exception;
    List<MenuTree> findMenuChildTree(String id) throws Exception;

    List<com.lingxu.base.system.orgManage.vo.MenuTree> findSysMenuListNew() throws Exception;

    /**
     * @Author ysj闫世杰
     * @Description 查询是否存在子菜单
     * @Date 2022/6/16 9:25
     * @Param: id
     * @return java.lang.Integer
     **/
    Integer findChild(String id) throws Exception;

    /**
     * @Author ysj闫世杰
     * @Description 删除菜单
     * @Date 2022/6/16 10:42
     * @Param: list
     * @return void
     **/
    void deleteSysMenu(@Param("list") List<String> list);

    List<SysMenu> findMenuButtonList(String menuId) throws Exception;


    void deleteUserMenu(List<String> list) throws Exception;

    List<SysMenu> findMenuListBycategoryAndIdOld(@Param("category")String category,@Param("id") String id,@Param("userid") String userid);

    List<SysMenu> findMenuListBycategoryAndId(@Param("category")String category,@Param("id") String id,@Param("userid") String userid);

    List<SysMenu> findMenuList(@Param("sysMenu")SysMenu sysMenu,@Param("userid")String userid);

    List<SysMenu> findMenuListByMenuPidAndUserid(@Param("menupid")String menupid, @Param("userid")String userid);
    /*======================================================sys_menu新================================================================*/



    /**
     * @Author ysj闫世杰
     * @Description 查询未分配菜单
     * @Date 2022/3/7 10:04
     * @Param: roleId
     * @return java.util.List<com.lingxu.base.system.orgManage.entity.MenuTree>
     **/
    List<MenuTree> findRoleNotExistMenu(String roleId) throws Exception;

    /**
     * @Author ysj闫世杰
     * @Description 查询已分配菜单
     * @Date 2022/3/7 10:04
     * @Param: roleId
     * @return java.util.List<com.lingxu.base.system.orgManage.entity.MenuTree>
     **/
    List<MenuTree> findRoleExistMenu(String roleId);
}
